package com.springCloudStudy.config;

import com.MyRibbonRuleConfig.MyRibbonConfig;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @PROJECT_NAME: SpringCloud_Study_atGuiGU
 * @NAME: TemplateConfig
 * @Author: lidongming
 * @DATE: 2022/2/6
 * @Desc:
 */
@Configuration
@LoadBalancerClient(value = "PROVIDER-PAYMENT-SERVER",configuration = MyRibbonConfig.class)
public class TemplateConfig {

//设置默认的负载均衡
    @LoadBalanced
    @Bean
    public RestTemplate getRestTemplate(){

        return new RestTemplate();
    }
}
